console.log('继续教育助手插件');
let version = "1.0.5";
console.log("当前版本", version);
// var jQueryObj = jQuery.noConflict();
// 向页面注入JS
function injectCustomJs(jsPath) {
    var temp = document.createElement('script');
    temp.setAttribute('type', 'text/javascript');
    // 获得的地址类似：chrome-extension://ihcokhadfjfchaeagdoclpnjdiokfakg/js/jsPath
    temp.src = chrome.extension.getURL(jsPath);
    temp.onload = function () {
        // 放在页面不好看，执行完后移除掉
        this.parentNode.removeChild(this);
    };
    document.head.appendChild(temp);
}

window.onload = function () {

    // console.log(jQuery.fn.jquery);
    var url = window.location.href;
    console.log('url:' + url);
    var website = "gdedu.gov.cn";
    var website2 = "****ly.com";
    var website3 = "****qunar.com";
    var website4 = "localhost";
    var website5 = localStorage['website'] ? localStorage['website'] : 'nowebsite';
    console.log("website:" + website, url.indexOf(website));
    if (url.indexOf(website) != -1 || url.indexOf(website2) != -1 || url.indexOf(website3) != -1 || url.indexOf(website4) != -1 || url.indexOf(website5) != -1) {
        console.log('插件加载');
        console.log('begin inject');
        injectCustomJs('js/inject.js');
        console.log('end inject');
    }
}


